package org.jeecg.modules.quartz.job;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.dynamic.datasource.annotation.DS;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.board.service.LineBoardService;
import org.jeecg.board.service.QisBoardService;
import org.jeecg.client.BizResponse;
import org.jeecg.client.SendUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.DateUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Slf4j
public class QisLineBoardJob implements Job {

    private String parameter;

    @Resource
    private QisBoardService qisBoardService;

    public void setParameter(String parameter) {
        this.parameter = parameter;
    }
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
//        HashMap<String, Object> map = new HashMap<>();
//        map.put("line",this.parameter);
//        qisBoardService.getQisLineBoardData(map);
        List<String> list = Arrays.asList(this.parameter.split(";"));
        for (int i = 0; i < list.size(); i++){
            Map<String, Object> map = new HashMap<>();
            map.put("line",list.get(i));
            qisBoardService.getQisLineBoardData(map);
        }
        log.info( String.format("welcome %s! 质量看板定时任务 SampleParamJob !   时间:" + DateUtils.now(), this.parameter));
    }
}
